import type { ConfigEnv, UserConfig } from 'vite'

import { useApplicationConfig } from '@fl/vite-config'
import UnoCSS from 'unocss/vite'
import { mergeConfig } from 'vite'

export default ({ command, mode }: ConfigEnv): UserConfig => {
    const applicationConfig = useApplicationConfig({ command, mode })

    const overrides = {
        plugins: [
            UnoCSS(),
        ],
        preview: {
            port: 6110,
        },
        server: {
            // 端口号
            port: 6010,
        },
    }

    return mergeConfig(applicationConfig, overrides)
}
